#include "types.h"
#include "def.h"
#include "thread.h"
#include "condition.h"

void
waitCondition(Condvar *self)
{
    pushBack(&self->waitQueue,getCurrentTid());
    yieldCPU();
}

void
notifyCondition(Condvar *self)
{
    if(!isEmpty(&self->waitQueue)){
        int tid = (int)popFront(&self->waitQueue);
        wakeupCPU(tid);
    }
}